package day09;


import java.sql.PreparedStatement;

import java.util.List;

public class UserDaoImpl implements UserDao{
    @Override
    public void saveUsers(List<User> list) {
        String sql = "insert into users values";
        for(int i=0;i<list.size();i++){
            User user=list.get(i);
            PreparedStatement pstmt=null;
            try {
                pstmt=BaseDao.getConn().prepareStatement("insert into users values (?,?,?,?,?)");
                pstmt.setString(1,user.getName());
                pstmt.setString(2,user.getPwd());
                pstmt.setString(3,user.getEmail());
                pstmt.setString(4,user.getBirthday());
                pstmt.setInt(5,user.getMoney());
                pstmt.executeUpdate();
            } catch (Exception e) {
                e.printStackTrace();
            }finally {
                BaseDao.close(pstmt);

            }
        }
    }

    @Override
    public void editUsers(String name) {

    }

    @Override
    public void removeUsers(String name) {

    }

    @Override
    public List<User> listUsers() {
        return null;
    }

    @Override
    public void transfer(User user1, User user2, User user3) {

    }
}
